package com.m115.m115browser.fragment;

import com.m115.m115browser.R;

import android.annotation.SuppressLint;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

@SuppressLint("NewApi")
public class BrowserPageFragment extends Fragment {
	private static final String TAG = "BrowserFragment";
	private View view;
	private WebView mWebVWebContent;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		view = inflater.inflate(R.layout.page_browser_page, null);
		findViews();
		init();
		return view;
	}

	private void findViews() {
		mWebVWebContent = (WebView) view
				.findViewById(R.id.page_browserPage_mWebVWebContent);
	}

	private void init() {
		WebSettings settings = mWebVWebContent.getSettings();
		settings.setJavaScriptEnabled(true);
		settings.setPluginsEnabled(true);
		settings.setUseWideViewPort(true);
		settings.setSupportZoom(true);
		settings.setBuiltInZoomControls(true);
		settings.setDomStorageEnabled(true);
		settings.setLoadWithOverviewMode(true);
		if (Build.VERSION.SDK_INT >= 11) {
			mWebVWebContent.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
		}
		mWebVWebContent.setWebChromeClient(mWebChromeClient);
		mWebVWebContent.setWebViewClient(mWebViewClient);
		mWebVWebContent.loadUrl("http://www.baidu.com");
	}

	private WebChromeClient mWebChromeClient = new WebChromeClient() {
	};
	private WebViewClient mWebViewClient = new WebViewClient() {
	};

}
